using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerGuardState : PlayerState
{
    public PlayerGuardState(Player _player, PlayerStateMachine _stateMachine, string _animBoolName) : base(_player, _stateMachine, _animBoolName)
    {

    }

    public override void Enter()
    {
        base.Enter();

        statetimer = player.guardDuration;

        player.anim.SetBool("SuccessfulGuard", false);
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();

        if (player.SuccessfullyGuarding)
        {
            player.SuccessfullyGuarding = false;
            player.anim.SetBool("SuccessfulGuard", true);
            statetimer = 10;
        }

        if (statetimer < 0 || TriggerCalled)
        {
            player.stateMachine.Changestate(player.idleState);
        }
    }
}
